package com.lz.ovuola.repository.mysql.impl;

import java.util.Date;

import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Repository;

import com.lz.ovuola.entity.PhysiologicalEstimateDataDo;
import com.lz.ovuola.repository.mysql.MyDynamicRepository;

/**
 * 官方api：http://docs.spring.io/spring-data/jpa/docs/1.11.1.RELEASE/reference/
 * html/
 * 
 * @author fz
 *
 */
@Repository("physiologicalEstimateDataRepository")
@CacheConfig(cacheNames = "physiologicalEstimateDataDo")
public interface PhysiologicalEstimateDataRepository extends
		MyDynamicRepository<PhysiologicalEstimateDataDo, Integer> {

	@Cacheable(key = "#p0+'_table_physiological_estimate_data_cache'")
	PhysiologicalEstimateDataDo findByUserIdAndStartTime(Integer userId,
			Date StartTime);

	@SuppressWarnings("unchecked")
	@CachePut(key = "#p0.userId+'_table_physiological_estimate_data_cache'")
	PhysiologicalEstimateDataDo save(
			PhysiologicalEstimateDataDo physiologicalEstimateDataDo);

	@CacheEvict(key = "#p0.userId+'_table_physiological_estimate_data_cache'")
	void delete(PhysiologicalEstimateDataDo physiologicalEstimateDataDo);
}
